Skip to content

test: replace deprecated React test renderer - #85

Merged
kahme247 merged 3 commits into
ompweb-dev:mainfrom
andrebrait:test/react-testing-library
Sep 14, 2026
Merged

kahme247 merged 3 commits into
ompweb-dev:mainfrom
andrebrait:test/react-testing-library

Conversation

@andrebrait

@andrebrait andrebrait commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Replace all five react-test-renderer consumers with React Testing Library backed by jsdom; keep node:test and jiti.
  • Use real DOM events/storage and user-event for composer interactions, renderHook for lifecycle/state tests, and targeted browser/network mocks with explicit cleanup.
  • Remove the deprecated dependency, document the test setup, and use jsdom 29.x to retain Node 22.19.0 support. Production code and static renderToStaticMarkup tests are unchanged.
  • Preserve behavioral scenarios, including upstream live tool streaming coverage. Remove only the implementation-specific theme metadata enumeration test; strengthen observable theme DOM/storage/unmount assertions.

Verification

  • npm ci
  • npm run typecheck
  • npm run lint
  • npm test: 654 passed, 1 existing Windows-only skip on Linux
  • Original four migrated suites on Node 22.19.0: 33 passed, no renderer deprecation warnings
  • No remaining react-test-renderer references in source or lockfile
  • Single adversarial review covering contract, correctness, test honesty, and overengineering: approved, no blockers

Native navigation/layout still require browser verification; this test-only migration does not claim jsdom models those browser behaviors. No local Next production build was run, per development policy; CI runs it. npm audit reports three pre-existing dependencies with advisories (@humanfs/node, @xmldom/xmldom, js-yaml); all retain exactly their upstream versions and are outside this migration.

Latest-main refresh (2026-09-14)

Merged current upstream main (3d11f389, including #95 and #96) into this branch without rewriting the maintainer's earlier fixups. Resolved both test-file conflicts and migrated the incoming catch-up/recovery scenarios to the existing RTL harness, including null-session/options handling, foreground/online events, and unmount cleanup. Preserved all incoming regression assertions and the missing-metadata copy-button test. No production changes beyond the upstream merge and no test-gate changes.

Verification for 4f21694:

  • TypeScript passes.
  • ESLint passes with --max-warnings=0.
  • Full suite: 786 passed, 1 existing Windows-only skip on Linux.
  • Final focused MessageView and session-hook suites: 102 passed.
  • Single condensed adversarial review: no blockers; incoming hook test titles and all 260 assertions preserved.
  • Production builds are left to CI, per development policy.

The existing review-only companion is https://github.com/andrebrait/ompweb/pull/18; its base has been advanced to the same upstream commit so its diff matches this PR. Neither PR has been merged.

@andrebrait

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@andrebrait

Copy link
Copy Markdown
Collaborator Author

CI is green on Linux and Windows, including production builds. The local condensed adversarial review found no blockers. I attempted to request copilot-pull-request-reviewer, but GitHub rejected the GraphQL request for insufficient RequestReviewsByLogin permissions and the REST request returned 404. A maintainer with review-request permission must request Copilot. CodeRabbit was requested above; no response has arrived yet.

@andrebrait

Copy link
Copy Markdown
Collaborator Author

Copilot and CodeRabbit review results

To work around review-request permissions here, both bots reviewed the mirror at https://github.com/andrebrait/ompweb/pull/18. I verified that both PRs have exactly the same base (0541712e7ba541df23576f0b12e11b5a839dfe80) and head (fe11b6400041f29781ff31ba752e178476cd9e9f), so these results apply to this PR's current diff.

  • Copilot: Approval recommended; 0 comments. It reports 7/8 files reviewed, at Lite effort. Its submitted GitHub review state is COMMENTED, not a formal APPROVED review.
  • CodeRabbit: No actionable comments; minimal merge risk; ready to merge. The CodeRabbit check passed. It reviewed 7 files; package-lock.json was excluded by its default path filter.
  • Advisory disposition: CodeRabbit also reports default docstring coverage of 21.43% against its generic 80% threshold. This is a non-blocking bot warning, not a documented repository gate. No blanket docstrings or threshold changes were added to test helpers solely to satisfy it; the setup and testing conventions are documented in CONTRIBUTING.md.

No code fixes were requested by either review, so the reviewed commit remains unchanged. The prior condensed adversarial review included the lockfile. Upstream CI remains green: Linux and Windows verification, including production builds, plus PR quality gates.

The fork PR is a review-only mirror and has not been merged.

andrebrait and others added 2 commits September 13, 2026 18:31
…erer, unify lockfile

- MessageView.test.mjs: the grouped-tool-inputs test (added by #89 after this branch) drove Collapsible via TestRenderer internals; reworked onto Testing Library over the real DOM (row triggers, input toggles, rerender) with identical assertions. Last react-test-renderer consumer gone.
- package-lock.json: regenerated for the merged dependency set (main's dbus-next plus the Testing Library/jsdom swap).
@kahme247
kahme247 force-pushed the test/react-testing-library branch from fe11b64 to 3434e75 Compare September 13, 2026 15:40
@kahme247

Copy link
Copy Markdown
Collaborator

Maintainer update: this had gone stale after #89/#94 landed (CI was green only against the old base), so I rebased it onto current main and pushed the fixups to this branch:

  • Migrated the six fix(chat): recover saved replies before empty-response errors #94 recovery tests in hooks/useAgentSession.rpc.test.mjs into the new RTL harness (they arrived after this branch, still using the old unmountAll/docTarget helpers).
  • Migrated the grouped-tool-inputs test in components/MessageView.test.mjs (added by feat: expand complete tool inputs inline #89) off react-test-renderer onto Testing Library with identical assertions. It was the last remaining consumer, and the suite went red once the dependency was removed.
  • Regenerated package-lock.json for the merged dependency set.

tsc, lint, and the full suite (699 tests, 0 failures) pass on the pushed state. If you have local work on this branch you will need a git pull --rebase, sorry for the force-push. Happy to adjust anything or hand it back.

Preserve the maintainer's migration fixups and port the new session catch-up regressions to the RTL harness. Retain the visible copy-action regression from main.
@andrebrait

Copy link
Copy Markdown
Collaborator Author

Refreshed against latest main at 3d11f389 and pushed 4f21694 without force-pushing or discarding the maintainer's earlier fixups. Both conflicts are resolved; the new session catch-up tests now use the existing RTL harness, with incoming assertions preserved.

  • Local: typecheck and zero-warning ESLint pass; full suite 786 passed, 1 existing platform skip; final focused suites 102 passed.
  • Upstream CI: Linux and Windows pass, including tests and production builds; PR quality gates pass.
  • Single condensed adversarial review: no blockers.
  • Refreshed review-only companion andrebrait/ompweb#18 has the identical head and base. Copilot: approval recommended, 0 new comments, 8/9 files reviewed at Lite effort (GitHub state COMMENTED, not formal approval). CodeRabbit: no actionable issues in the refreshed migration/catch-up diff; it did not run tests itself.

No test gates were weakened. Neither PR has been merged.

@andrebrait

Copy link
Copy Markdown
Collaborator Author

@kahme247 shall we mergr this before making further changes?

@kahme247
kahme247 merged commit 24a8e1a into ompweb-dev:main Sep 14, 2026
3 checks passed
@andrebrait
andrebrait deleted the test/react-testing-library branch October 2, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants